import http from '@/axios'
import {handleError} from "vue";
import {handleSuccess} from "@/api/index.js";

export const applyCaseApi={
    //提交申请
    applyCase(data){
        return http.post('/api/cases',data)
        .then(res => handleSuccess(res, '提交申请成功'))
        .catch(error => handleError(error, '提交申请失败', '服务器异常'));
    },
     //上传文件
    uploadFile(data){
        return http.post('/upload', data, {
            headers: {
                'Content-Type': 'multipart/form-data'
            }
        })
        .then(res => handleSuccess(res, '上传文件成功'))
        .catch(error => handleError(error, '上传文件失败', '服务器异常'));
    },

}